package com.tiantianfresh.model.dao;

import com.tiantianfresh.model.pojo.OrderSpecific;
import com.tiantianfresh.model.pojo.ShoppingCart;
import org.apache.ibatis.annotations.*;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.Map;

/**
 * @author FANGAO
 * @date 2021/12/5 - 下午 20:44
 */
public interface OrderSpecificMapper extends Mapper<OrderSpecific> {

    int addShoppingCarts(@Param("shoppingCarts") List<ShoppingCart> shoppingCarts,@Param("orderid") String orderid);

    //@Delete("delete from r_order_specific where orderid = #{orderid}")
    //int deleteOrderSpecific(@Param("orderid") String orderid);

    @Select("select * from r_order_specific where userid = #{userid} and orderid = #{orderid}")
    List<OrderSpecific> queryChopCheckoutStateAll(Map<String,Object> map);

    @Select("select * from r_order_specific where userid = #{userid} and orderid=#{orderid}")
    List<OrderSpecific> queryOrderSpecificOrderId(@Param("orderid") String orderid, @Param("userid") Integer userid);

    @Insert("insert into  r_order_specific(commodityname,commoditypath,company,price,quantity,userid,orderid) value (#{commodityname},#{commoditypath},#{company},#{price},#{quantity},#{userid},#{orderid})")
    int addOrderSpecific(OrderSpecific orderSpecific);

    @Select("select * from r_order_specific where orderid=#{orderid}")
    List<OrderSpecific> queryOrderSpecific(@Param("orderid")String orderid);
}
